{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "----------------\n",
    "* 本学习记录人：许智超\n",
    "* 学习时间： 2021-11-02\n",
    "* week10\n",
    "* 本记录主要参考文档：\n",
    "> 1. [Python官方文档](https://docs.python.org/3/)\n",
    ">> 1. [Tutorial](https://docs.python.org/3/tutorial/index.html)\n",
    ">> 2. [Library Reference](https://docs.python.org/3/library/index.html)\n",
    "> 2. [许老师博客](https://www.cnblogs.com/xuzhichao/p/11407192.html)\n",
    "> 3. [python在线学习平台](https://www.datacamp.com/)\n",
    "----------------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 本周学习内容\n",
    "\n",
    "## 1. 字符串和数值的一般方法\n",
    "\n",
    "### 1. 字符串\n",
    "\n",
    "> 1. [字符串概念](https://docs.python.org/3/tutorial/introduction.html#strings)\n",
    ">> 1. single quotes ('...') \n",
    ">> 2. double quotes (\"...\") \n",
    ">> 3. <font style=\"color:red\">\"\"\"...\"\"\" or '''...'''</font> :不修改文本样式\n",
    ">> 4. 字符串的 拼接： str1 + str2，连接变量或变量和文字，请使用+\n",
    ">> 5. 字符串的索引性质（**index**）：字符串可以被索引（下标），第一个字符的索引为 0\n",
    ">>> * 案例：\n",
    "```\n",
    " +---+---+---+---+---+---+\n",
    " | P | y | t | h | o | n |\n",
    " +---+---+---+---+---+---+\n",
    " 0   1   2   3   4   5   6\n",
    "-6  -5  -4  -3  -2  -1\n",
    "```\n",
    ">> 6. 字符串的切片(**slice**) : [start:stop]\n",
    "> 2. [字符串的一般方法-String Methods](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "text = \"python\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'p'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "text[0] # index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'y'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "text[1] # index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'py'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "text[0:2] # slice 右边的值取不到"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " #### 1.1字符串的一般方法\n",
    " \n",
    " * 应掌握：\n",
    " > 1. 知道str的方法使用一般操作 str.methods_name()\n",
    " > 2. 了解python的字符串官方网站查询位置（或者能够在搜索浏览器查询）\n",
    " > 3. 能够在后续遇到字符串问题时能找到解决方法\n",
    " > 4. 了解常见方法： count，capitalize，isdigit，format，strip，split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "text = \"python\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Python'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# str.capitalize( ) \n",
    "# 返回字符串的副本，其中第一个字符大写，其余字符小写\n",
    "\"python\".capitalize()\n",
    "text.capitalize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'     python    '"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# str.center(width)  width 是一个 数值\n",
    "text.center(15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# str.count()\n",
    "text_center = \"Return centered in a string of length width. Padding is done using the specified fillchar (default is an ASCII space). The original string is returned if width is less than or equal to len(s).\"\n",
    "text_center.count(\"string\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# str.isdigit() 判断字符串是否是数值  False 不是数值 True 是数值\n",
    "text_center.isdigit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id = \"    20200000001   \"\n",
    "stu_id.isdigit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'20200000001'"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# str.strip() 清除文本中首位和末尾的所有空格\n",
    "stu_id.strip()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. [数值](https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)\n",
    "\n",
    "> 1. python 作为运算器，了解一般的运算符\n",
    "> 2. 了解运算符的先后顺序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. [for循环遍历](https://docs.python.org/3/tutorial/controlflow.html#for-statements)\n",
    "\n",
    "### 1.for循环+range()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "# 1. for循环\n",
    "# 2. range()\n",
    "# 总结：\n",
    "for i in range(5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P\n",
      "y\n",
      "t\n",
      "h\n",
      "o\n",
      "n\n"
     ]
    }
   ],
   "source": [
    "for i in \"Python\":\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 Head First Rocks!\n",
      "1 Head First Rocks!\n",
      "2 Head First Rocks!\n",
      "3 Head First Rocks!\n",
      "4 Head First Rocks!\n"
     ]
    }
   ],
   "source": [
    "# range与 for 循环使用，主要目标：决定for循环执行的次数\n",
    "# i 指 item 内容，item是一个变量，每次循环都会变\n",
    "# 第一次循环 i = 0 ，第二次循环 i = 1...\n",
    "for i in range(5):\n",
    "    # 如果没有用到 num 这个值\n",
    "    print('Head First Rocks!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.nfu.edu.cn/xydt/index.htm\n",
      "https://www.nfu.edu.cn/xydt/index1.htm\n",
      "https://www.nfu.edu.cn/xydt/index2.htm\n",
      "https://www.nfu.edu.cn/xydt/index3.htm\n",
      "https://www.nfu.edu.cn/xydt/index4.htm\n",
      "https://www.nfu.edu.cn/xydt/index5.htm\n",
      "https://www.nfu.edu.cn/xydt/index6.htm\n",
      "https://www.nfu.edu.cn/xydt/index7.htm\n",
      "https://www.nfu.edu.cn/xydt/index8.htm\n",
      "https://www.nfu.edu.cn/xydt/index9.htm\n",
      "https://www.nfu.edu.cn/xydt/index10.htm\n",
      "https://www.nfu.edu.cn/xydt/index11.htm\n",
      "https://www.nfu.edu.cn/xydt/index12.htm\n",
      "https://www.nfu.edu.cn/xydt/index13.htm\n",
      "https://www.nfu.edu.cn/xydt/index14.htm\n",
      "https://www.nfu.edu.cn/xydt/index15.htm\n",
      "https://www.nfu.edu.cn/xydt/index16.htm\n",
      "https://www.nfu.edu.cn/xydt/index17.htm\n",
      "https://www.nfu.edu.cn/xydt/index18.htm\n",
      "https://www.nfu.edu.cn/xydt/index19.htm\n",
      "https://www.nfu.edu.cn/xydt/index20.htm\n",
      "https://www.nfu.edu.cn/xydt/index21.htm\n",
      "https://www.nfu.edu.cn/xydt/index22.htm\n",
      "https://www.nfu.edu.cn/xydt/index23.htm\n",
      "https://www.nfu.edu.cn/xydt/index24.htm\n",
      "https://www.nfu.edu.cn/xydt/index25.htm\n",
      "https://www.nfu.edu.cn/xydt/index26.htm\n",
      "https://www.nfu.edu.cn/xydt/index27.htm\n",
      "https://www.nfu.edu.cn/xydt/index28.htm\n",
      "https://www.nfu.edu.cn/xydt/index29.htm\n",
      "https://www.nfu.edu.cn/xydt/index30.htm\n",
      "https://www.nfu.edu.cn/xydt/index31.htm\n",
      "https://www.nfu.edu.cn/xydt/index32.htm\n",
      "https://www.nfu.edu.cn/xydt/index33.htm\n",
      "https://www.nfu.edu.cn/xydt/index34.htm\n",
      "https://www.nfu.edu.cn/xydt/index35.htm\n",
      "https://www.nfu.edu.cn/xydt/index36.htm\n",
      "https://www.nfu.edu.cn/xydt/index37.htm\n",
      "https://www.nfu.edu.cn/xydt/index38.htm\n",
      "https://www.nfu.edu.cn/xydt/index39.htm\n",
      "https://www.nfu.edu.cn/xydt/index40.htm\n",
      "https://www.nfu.edu.cn/xydt/index41.htm\n",
      "https://www.nfu.edu.cn/xydt/index42.htm\n",
      "https://www.nfu.edu.cn/xydt/index43.htm\n",
      "https://www.nfu.edu.cn/xydt/index44.htm\n",
      "https://www.nfu.edu.cn/xydt/index45.htm\n",
      "https://www.nfu.edu.cn/xydt/index46.htm\n",
      "https://www.nfu.edu.cn/xydt/index47.htm\n",
      "https://www.nfu.edu.cn/xydt/index48.htm\n",
      "https://www.nfu.edu.cn/xydt/index49.htm\n",
      "https://www.nfu.edu.cn/xydt/index50.htm\n",
      "https://www.nfu.edu.cn/xydt/index51.htm\n",
      "https://www.nfu.edu.cn/xydt/index52.htm\n",
      "https://www.nfu.edu.cn/xydt/index53.htm\n",
      "https://www.nfu.edu.cn/xydt/index54.htm\n",
      "https://www.nfu.edu.cn/xydt/index55.htm\n",
      "https://www.nfu.edu.cn/xydt/index56.htm\n",
      "https://www.nfu.edu.cn/xydt/index57.htm\n",
      "https://www.nfu.edu.cn/xydt/index58.htm\n",
      "https://www.nfu.edu.cn/xydt/index59.htm\n",
      "https://www.nfu.edu.cn/xydt/index60.htm\n",
      "https://www.nfu.edu.cn/xydt/index61.htm\n",
      "https://www.nfu.edu.cn/xydt/index62.htm\n",
      "https://www.nfu.edu.cn/xydt/index63.htm\n",
      "https://www.nfu.edu.cn/xydt/index64.htm\n",
      "https://www.nfu.edu.cn/xydt/index65.htm\n",
      "https://www.nfu.edu.cn/xydt/index66.htm\n",
      "https://www.nfu.edu.cn/xydt/index67.htm\n",
      "https://www.nfu.edu.cn/xydt/index68.htm\n",
      "https://www.nfu.edu.cn/xydt/index69.htm\n",
      "https://www.nfu.edu.cn/xydt/index70.htm\n",
      "https://www.nfu.edu.cn/xydt/index71.htm\n",
      "https://www.nfu.edu.cn/xydt/index72.htm\n",
      "https://www.nfu.edu.cn/xydt/index73.htm\n",
      "https://www.nfu.edu.cn/xydt/index74.htm\n",
      "https://www.nfu.edu.cn/xydt/index75.htm\n",
      "https://www.nfu.edu.cn/xydt/index76.htm\n",
      "https://www.nfu.edu.cn/xydt/index77.htm\n",
      "https://www.nfu.edu.cn/xydt/index78.htm\n",
      "https://www.nfu.edu.cn/xydt/index79.htm\n",
      "https://www.nfu.edu.cn/xydt/index80.htm\n",
      "https://www.nfu.edu.cn/xydt/index81.htm\n",
      "https://www.nfu.edu.cn/xydt/index82.htm\n",
      "https://www.nfu.edu.cn/xydt/index83.htm\n",
      "https://www.nfu.edu.cn/xydt/index84.htm\n",
      "https://www.nfu.edu.cn/xydt/index85.htm\n",
      "https://www.nfu.edu.cn/xydt/index86.htm\n",
      "https://www.nfu.edu.cn/xydt/index87.htm\n",
      "https://www.nfu.edu.cn/xydt/index88.htm\n",
      "https://www.nfu.edu.cn/xydt/index89.htm\n",
      "https://www.nfu.edu.cn/xydt/index90.htm\n",
      "https://www.nfu.edu.cn/xydt/index91.htm\n",
      "https://www.nfu.edu.cn/xydt/index92.htm\n",
      "https://www.nfu.edu.cn/xydt/index93.htm\n"
     ]
    }
   ],
   "source": [
    "# 实践：获取（抓取）学校所有新闻页面链接\n",
    "# 用到的知识点 ： 1. 变量、赋值 2. 字符串拼接 3. 条件判断 4. for循环 5. range\n",
    "# 南方学院 学校要闻\n",
    "学校域名 = \"https://www.nfu.edu.cn/\"\n",
    "学校要闻 = \"xxyw/\"\n",
    "校园动态 = \"xydt/\"\n",
    "学校要闻第一页 = 学校域名 + 校园动态 + \"index\" +\"0\" + \".htm\"\n",
    "for i in range(94):\n",
    "    if i == 0:\n",
    "        print(学校域名 + 校园动态 + \"index\" + \".htm\")\n",
    "    else:\n",
    "        print(学校域名 + 校园动态 + \"index\" + str(i) + \".htm\")\n",
    "# 其他：如 校园动态 等，更改两个内容，一个是 xydt/   一个是 页数"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> 1. range()可以生成一组序列数值\n",
    ">> * 如：range(10)，生成10个数，从0开始，每次 +1\n",
    ">> * 如：range(5,10)，生成 stop-start 个数 即10-5=5 个数，从5开始，每次+1\n",
    ">> * 如：range(0,10,3)，10-0=10个数， 从0开始， 每次+3\n",
    "> 2. 如果和for循环一起使用，可以决定for循环的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# range: 范围 ,10 代表： 1. 10个数值，2. 终止点是10\n",
    "# 只有一个值：start：0（默认）   stop（终止值）：10  step(步长)：1（默认）\n",
    "# 如：10，生成10个数，从0开始，每次 +1\n",
    "list(range(10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 只有两个值：start：5   stop（终止值）：10  step(步长)：1（默认）\n",
    "list(range(5,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 3, 6, 9]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 有三个值：start：0  stop（终止值）：10 step(步长)：3\n",
    "list(range(0,10,3))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. random模块（随机数）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 调用模块\n",
    "import random\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.01125314490693019"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 随机从 0-1 取值\n",
    "random.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "52\n",
      "10\n",
      "5\n",
      "69\n",
      "53\n",
      "86\n",
      "15\n",
      "9\n"
     ]
    }
   ],
   "source": [
    "# 福利彩票生成器\n",
    "本次开奖 = \"15,25,35,45,56,45,23,23\"\n",
    "for i in range(8):\n",
    "    print(round(random.random()*100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "91"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "round(random.random()*100)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 给定数值范围\n",
    "random.randint(1,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "6\n",
      "2\n",
      "5\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "# 摇骰子\n",
    "for i in range(5):\n",
    "    print(random.randint(1,6))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'古茵'"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 随机点名 choice\n",
    "stu_names = [\"古茵\",\"刘博泽\",\"黄奕桁\",\"黄启宇\"]\n",
    "random.choice(stu_names)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# help(me!!!!!)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "```\n",
    "randint(a, b) method of Random instance\n",
    "        Return random integer in range [a, b], including both end points.\n",
    "\n",
    " random(...) method of Random instance\n",
    "        random() -> x in the interval [0, 1).\n",
    "\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module random:\n",
      "\n",
      "NAME\n",
      "    random - Random variable generators.\n",
      "\n",
      "DESCRIPTION\n",
      "        integers\n",
      "        --------\n",
      "               uniform within range\n",
      "    \n",
      "        sequences\n",
      "        ---------\n",
      "               pick random element\n",
      "               pick random sample\n",
      "               pick weighted random sample\n",
      "               generate random permutation\n",
      "    \n",
      "        distributions on the real line:\n",
      "        ------------------------------\n",
      "               uniform\n",
      "               triangular\n",
      "               normal (Gaussian)\n",
      "               lognormal\n",
      "               negative exponential\n",
      "               gamma\n",
      "               beta\n",
      "               pareto\n",
      "               Weibull\n",
      "    \n",
      "        distributions on the circle (angles 0 to 2pi)\n",
      "        ---------------------------------------------\n",
      "               circular uniform\n",
      "               von Mises\n",
      "    \n",
      "    General notes on the underlying Mersenne Twister core generator:\n",
      "    \n",
      "    * The period is 2**19937-1.\n",
      "    * It is one of the most extensively tested generators in existence.\n",
      "    * The random() method is implemented in C, executes in a single Python step,\n",
      "      and is, therefore, threadsafe.\n",
      "\n",
      "CLASSES\n",
      "    _random.Random(builtins.object)\n",
      "        Random\n",
      "            SystemRandom\n",
      "    \n",
      "    class Random(_random.Random)\n",
      "     |  Random number generator base class used by bound module functions.\n",
      "     |  \n",
      "     |  Used to instantiate instances of Random to get generators that don't\n",
      "     |  share state.\n",
      "     |  \n",
      "     |  Class Random can also be subclassed if you want to use a different basic\n",
      "     |  generator of your own devising: in that case, override the following\n",
      "     |  methods:  random(), seed(), getstate(), and setstate().\n",
      "     |  Optionally, implement a getrandbits() method so that randrange()\n",
      "     |  can cover arbitrarily large ranges.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      helper for pickle\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  getstate(self)\n",
      "     |      Return internal state; can be passed to setstate() later.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1, _int=<class 'int'>)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      To choose a sample in a range of integers, use range as an argument.\n",
      "     |      This is especially fast and space efficient for sampling from a\n",
      "     |      large population:   sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  seed(self, a=None, version=2)\n",
      "     |      Initialize internal state from hashable object.\n",
      "     |      \n",
      "     |      None or no argument seeds from current time or from an operating\n",
      "     |      system specific randomness source if available.\n",
      "     |      \n",
      "     |      If *a* is an int, all bits are used.\n",
      "     |      \n",
      "     |      For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "     |      bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "     |      sequences from older versions of Python), the algorithm for str and\n",
      "     |      bytes generates a narrower range of seeds.\n",
      "     |  \n",
      "     |  setstate(self, state)\n",
      "     |      Restore internal state from object returned by getstate().\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  getrandbits(...)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  random(...)\n",
      "     |      random() -> x in the interval [0, 1).\n",
      "    \n",
      "    class SystemRandom(Random)\n",
      "     |  Alternate random number generator using sources provided\n",
      "     |  by the operating system (such as /dev/urandom on Unix or\n",
      "     |  CryptGenRandom on Windows).\n",
      "     |  \n",
      "     |   Not available on all systems (see os.urandom() for details).\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      SystemRandom\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  getrandbits(self, k)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  getstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  random(self)\n",
      "     |      Get the next random number in the range [0.0, 1.0).\n",
      "     |  \n",
      "     |  seed(self, *args, **kwds)\n",
      "     |      Stub method.  Not used for a system random number generator.\n",
      "     |  \n",
      "     |  setstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from Random:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      helper for pickle\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1, _int=<class 'int'>)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      To choose a sample in a range of integers, use range as an argument.\n",
      "     |      This is especially fast and space efficient for sampling from a\n",
      "     |      large population:   sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from Random:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes inherited from Random:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "\n",
      "FUNCTIONS\n",
      "    betavariate(alpha, beta) method of Random instance\n",
      "        Beta distribution.\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        Returned values range between 0 and 1.\n",
      "    \n",
      "    choice(seq) method of Random instance\n",
      "        Choose a random element from a non-empty sequence.\n",
      "    \n",
      "    choices(population, weights=None, *, cum_weights=None, k=1) method of Random instance\n",
      "        Return a k sized list of population elements chosen with replacement.\n",
      "        \n",
      "        If the relative weights or cumulative weights are not specified,\n",
      "        the selections are made with equal probability.\n",
      "    \n",
      "    expovariate(lambd) method of Random instance\n",
      "        Exponential distribution.\n",
      "        \n",
      "        lambd is 1.0 divided by the desired mean.  It should be\n",
      "        nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "        a reserved word in Python.)  Returned values range from 0 to\n",
      "        positive infinity if lambd is positive, and from negative\n",
      "        infinity to 0 if lambd is negative.\n",
      "    \n",
      "    gammavariate(alpha, beta) method of Random instance\n",
      "        Gamma distribution.  Not the gamma function!\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        \n",
      "        The probability distribution function is:\n",
      "        \n",
      "                    x ** (alpha - 1) * math.exp(-x / beta)\n",
      "          pdf(x) =  --------------------------------------\n",
      "                      math.gamma(alpha) * beta ** alpha\n",
      "    \n",
      "    gauss(mu, sigma) method of Random instance\n",
      "        Gaussian distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.  This is\n",
      "        slightly faster than the normalvariate() function.\n",
      "        \n",
      "        Not thread-safe without a lock around calls.\n",
      "    \n",
      "    getrandbits(...) method of Random instance\n",
      "        getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "    \n",
      "    getstate() method of Random instance\n",
      "        Return internal state; can be passed to setstate() later.\n",
      "    \n",
      "    lognormvariate(mu, sigma) method of Random instance\n",
      "        Log normal distribution.\n",
      "        \n",
      "        If you take the natural logarithm of this distribution, you'll get a\n",
      "        normal distribution with mean mu and standard deviation sigma.\n",
      "        mu can have any value, and sigma must be greater than zero.\n",
      "    \n",
      "    normalvariate(mu, sigma) method of Random instance\n",
      "        Normal distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.\n",
      "    \n",
      "    paretovariate(alpha) method of Random instance\n",
      "        Pareto distribution.  alpha is the shape parameter.\n",
      "    \n",
      "    randint(a, b) method of Random instance\n",
      "        Return random integer in range [a, b], including both end points.\n",
      "    \n",
      "    random(...) method of Random instance\n",
      "        random() -> x in the interval [0, 1).\n",
      "    \n",
      "    randrange(start, stop=None, step=1, _int=<class 'int'>) method of Random instance\n",
      "        Choose a random item from range(start, stop[, step]).\n",
      "        \n",
      "        This fixes the problem with randint() which includes the\n",
      "        endpoint; in Python this is usually not what you want.\n",
      "    \n",
      "    sample(population, k) method of Random instance\n",
      "        Chooses k unique random elements from a population sequence or set.\n",
      "        \n",
      "        Returns a new list containing elements from the population while\n",
      "        leaving the original population unchanged.  The resulting list is\n",
      "        in selection order so that all sub-slices will also be valid random\n",
      "        samples.  This allows raffle winners (the sample) to be partitioned\n",
      "        into grand prize and second place winners (the subslices).\n",
      "        \n",
      "        Members of the population need not be hashable or unique.  If the\n",
      "        population contains repeats, then each occurrence is a possible\n",
      "        selection in the sample.\n",
      "        \n",
      "        To choose a sample in a range of integers, use range as an argument.\n",
      "        This is especially fast and space efficient for sampling from a\n",
      "        large population:   sample(range(10000000), 60)\n",
      "    \n",
      "    seed(a=None, version=2) method of Random instance\n",
      "        Initialize internal state from hashable object.\n",
      "        \n",
      "        None or no argument seeds from current time or from an operating\n",
      "        system specific randomness source if available.\n",
      "        \n",
      "        If *a* is an int, all bits are used.\n",
      "        \n",
      "        For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "        bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "        sequences from older versions of Python), the algorithm for str and\n",
      "        bytes generates a narrower range of seeds.\n",
      "    \n",
      "    setstate(state) method of Random instance\n",
      "        Restore internal state from object returned by getstate().\n",
      "    \n",
      "    shuffle(x, random=None) method of Random instance\n",
      "        Shuffle list x in place, and return None.\n",
      "        \n",
      "        Optional argument random is a 0-argument function returning a\n",
      "        random float in [0.0, 1.0); if it is the default None, the\n",
      "        standard random.random will be used.\n",
      "    \n",
      "    triangular(low=0.0, high=1.0, mode=None) method of Random instance\n",
      "        Triangular distribution.\n",
      "        \n",
      "        Continuous distribution bounded by given lower and upper limits,\n",
      "        and having a given mode value in-between.\n",
      "        \n",
      "        http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "    \n",
      "    uniform(a, b) method of Random instance\n",
      "        Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "    \n",
      "    vonmisesvariate(mu, kappa) method of Random instance\n",
      "        Circular data distribution.\n",
      "        \n",
      "        mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "        kappa is the concentration parameter, which must be greater than or\n",
      "        equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "        to a uniform random angle over the range 0 to 2*pi.\n",
      "    \n",
      "    weibullvariate(alpha, beta) method of Random instance\n",
      "        Weibull distribution.\n",
      "        \n",
      "        alpha is the scale parameter and beta is the shape parameter.\n",
      "\n",
      "DATA\n",
      "    __all__ = ['Random', 'seed', 'random', 'uniform', 'randint', 'choice',...\n",
      "\n",
      "FILE\n",
      "    c:\\users\\zdnf\\anaconda3\\lib\\random.py\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当前时间节点的秒数： 46\n",
      "Not an odd second.\n",
      "等待的时间： 4\n",
      "--------------------\n",
      "当前时间节点的秒数： 50\n",
      "Not an odd second.\n",
      "等待的时间： 1\n",
      "--------------------\n",
      "当前时间节点的秒数： 51\n",
      "This second seems a little odd.\n",
      "等待的时间： 2\n",
      "--------------------\n",
      "当前时间节点的秒数： 53\n",
      "This second seems a little odd.\n",
      "等待的时间： 1\n",
      "--------------------\n",
      "当前时间节点的秒数： 54\n",
      "Not an odd second.\n",
      "等待的时间： 1\n",
      "--------------------\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "import random\n",
    "import time\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "for i in range(5):\n",
    "    # range决定了执行的次数\n",
    "    right_this_second = datetime.today().second\n",
    "    print('当前时间节点的秒数：',right_this_second)\n",
    "    if right_this_second in odds:\n",
    "        print(\"This second seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd second.\")\n",
    "    wait_time = random.randint(1,5)\n",
    "    print('等待的时间：',wait_time)\n",
    "    print(\"--------------------\")\n",
    "    time.sleep(wait_time)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
